package com.tdam2011.grupo02.compatibility;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;

public class ActionBarListActivity extends ListActivity {
	final ActionBarHelper actionBarHelper = ActionBarHelper
			.createInstance(this);

	/**
	 * Returns the {@link ActionBarHelper} for this activity.
	 */
	protected ActionBarHelper getActionBarHelper() {
		return actionBarHelper;
	}

	@Override
	public MenuInflater getMenuInflater() {
		return actionBarHelper.getMenuInflater(super.getMenuInflater());
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		actionBarHelper.onCreate(savedInstanceState);
	}

	@Override
	protected void onPostCreate(Bundle savedInstanceState) {
		super.onPostCreate(savedInstanceState);
		actionBarHelper.onPostCreate(savedInstanceState);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		boolean retValue = false;
		retValue |= actionBarHelper.onCreateOptionsMenu(menu);
		retValue |= super.onCreateOptionsMenu(menu);
		return retValue;
	}

	@Override
	protected void onTitleChanged(CharSequence title, int color) {
		actionBarHelper.onTitleChanged(title, color);
		super.onTitleChanged(title, color);
	}
}
